<include file="../header" />

<script type="text/javascript" src="/Template/js/vue.min.js"></script>

<body class="J_scroll_fixed" id="container">
<script type="text/javascript">
    $(function() {

        $("button.btn_submit").click(function() {
            if($("input[name=supplier_name]").val() == ""){
                alert("请填写【名称】");
                $("input[name=supplier_name]").focus();
                return false;
            }

            $("button.btn_submit").hide();

        });

        $("button#upload").click(function(){
            //上传文件
            $.ajaxFileUpload({
                url:"{:U('activity/uploadImage')}",//处理图片脚本
                secureuri :false,
                fileElementId :'fileToUpload',//file控件id
                dataType : 'json',
                success : function (data, status){
                    $("input[name=imageUrl]").val(data);
                    $("img[name=preShow]").attr("src", data);
                },
                error: function(data, status, e){
                    alert(e);
                }
            })

        });
    })

</script>

<div class="wrap jj">
    <div class="common-form">
        <form method="post" class="form-horizontal J_ajaxForm" action="{:U('Supplier/editPost')}">
            <fieldset>
                <input type="hidden" name="id" value="{$info.supplier_id}" />
                <div class="control-group">
                    <label class="control-label">名称：</label>
                    <div class="controls">
                        <input type="text" class="input" name="supplier_name" value="{$info.supplier_name}">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">地址：</label>
                    <div class="controls">
                        <input type="text" class="input" name="address" value="{$info.address}">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">电话：</label>
                    <div class="controls">
                        <input type="text" class="input" name="mobile" value="{$info.mobile}">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">联系人：</label>
                    <div class="controls">
                        <textarea style="height:4rem;" name="contact">{$info.contact}</textarea>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">银行信息：</label>
                    <div class="controls">
                        <textarea style="height:4rem;" name="bank_info">{$info.bank_info}</textarea>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">经营产品：</label>
                    <div class="controls">
                        <textarea style="height:4rem;" name="product">{$info.product}</textarea>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">备注：</label>
                    <div class="controls">
                        <textarea style="height:4rem;" name="remark">{$info.remark}</textarea>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">图片:</label>
                    <div class="controls">
                        <input id="fileToUpload" type="file" name="fileToUpload" style="width:170px;">
                        <button type="button" class="btn btn-primary" id="upload">上传</button>
                        <input type="hidden" name="imageUrl" value="{$info.license_img}"/>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">图片预览:</label>
                    <div class="controls">
                        <img src="{$info.license_img}" name="preShow" style="width:200px;height:200px;"/>
                    </div>
                </div>
            </fieldset>
            <div class="form-actions">
                <button type="submit" class="btn btn-primary btn_submit">更新</button>
                <a class="btn" href="__URL__">返回</a>
            </div>
        </form>
    </div>
</div>
<script src="__ROOT__/statics/js/common.js"></script>
</body>
</html>